package br.gerenciadorAudio.BLL;

import java.text.ParseException;
import android.view.View;
import android.widget.CheckBox;

public class Common {

	public static CheckBox GetObjectByCheckBox(View view, int id)
	{
		return (CheckBox)view.findViewById(id);
	}
	
	public static String ConvertToTimeString(int hour,int minute) throws ParseException
	{
		try
		{
			//SimpleDateFormat df = new SimpleDateFormat("yyyy-dd-MM hh:mm");
			//Date date = df.parse(hour + ":" + minute);
			//String dateFormat = df.format(date);
			return hour + ":" + minute;
		}
		catch (Exception e) {
			// TODO: handle exception
			return null;
		}
	}
	
	public static int GetHour(String hour) throws ParseException
	{
		try
		{
			return Integer.parseInt(hour.split(":")[0]);
		}
		catch (Exception e) {
			// TODO: handle exception
			return 00;
		}
	}
	
	public static int GetMinute(String hour) throws ParseException
	{
		try
		{
			return Integer.parseInt(hour.split(":")[1]);
		}
		catch (Exception e) {
			// TODO: handle exception
			return 00;
		}
	}

}
